<?php
error_reporting(-1);
include "const.php"; //加载常量
include "init.php";
include "./lib/function.php";

$act = isset($_GET['act']) ? $_GET['act'] : "index"; //处理动作参数
$tpl_file = TPL_PATH . $act . ".php"; //加载文件之前 还要检测是否有某个钩子函数 来处理数据
$function = "hock_" . $act;
if (function_exists($function)) {
    $data = $function();
    !empty($data) && extract($data); //变量拆分 导入到符号表
}
if (is_file($tpl_file)) {

    include $tpl_file;
} else {
    //捕获模板不存在
    die($tpl_file . "模板不存在");
}
